@(verkefni: (models.data.Verkefni), verkefnihops: (models.data.verkefnihops), upphafs: String, loka: String, skilafresturLidinn: Boolean,
nemendur: List[models.domain.Students], verkNem: List[models.data.verkefninemenda],athugasemdir: List[models.domain.Comments], hopur_id : Integer,
hafaSkilad: Int, ekkiSkilad: Int, vidhengiNemenda : Boolean, verkefnihopsID : Int)
@import data.Verkefni
@import scala._
@teacherMain(title = "Verkefni") {

    <script src="/public/javascripts/amcharts.js" type="text/javascript"></script>
    <script src="/public/javascripts/dashboard.js"></script>
    <link rel="stylesheet" href="/public/stylesheets/bootstrap-datetimepicker.min.css">
    <script src="/public/javascripts/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript">
            var chart;
            var legend;

            var chartData = [{
            skilad: "Hafa skilað",
            fjoldi: @{hafaSkilad},
            color: "#00CC00"
            }, {
            skilad: "Hafa ekki skilað",
            fjoldi: @{ekkiSkilad},
            color:"#FF0F00"
            }];

            AmCharts.ready(function () {
            // PIE CHART
            chart = new AmCharts.AmPieChart();
            chart.dataProvider = chartData;
            chart.titleField = "skilad";
            chart.valueField = "fjoldi";
            chart.colorField="color";
            chart.outlineColor = "#FFFFFF";
            chart.outlineAlpha = 0.8;
            chart.outlineThickness = 2;

            // WRITE
            chart.write("chartdiv");
            $("g").find("tspan").last().hide();
            });

        $(function(){
            $("#einkunnFold").hide();
            })


            $(function() {
            $('#datetimepicker').datetimepicker({
            language: 'pt-BR'
            });
            });
</script>
    <div class="container conLower">
        <div class="row">
            <div class="span1">
            </div>
            <div class="span9">
                <table class = "table table-striped">
                    <tr class= "table_smallerFont">
                        <th>Nafn</th>
                        <td>@{verkefni.heiti}</td>
                        <td><a class="blackLink underScore" href="@routes.TeacherController.assignment(verkefni.verkefni_id, verkefni.getHeiti)">Smelltu hér til þess að skoða verkefnið nánar</a></td>
                    </tr>
                    <tr class ="table_smallerFont">
                        <th>Lagt fyrir </th>
                        <td>@{upphafs}</td>
                        <td></td>
                   </tr>
                    <tr class="table_smallerFont">
                        <th> Skilafrestur </th>
                        <td> @{loka}</td>
                        <td><a class="blackLink underScore" href="#deadline" data-toggle="modal">Breyta skilafrest</a></td>
                    </tr>
                    <tr class ="table_smallerFont">
                        <th> Vægi verkefnis </th>
                        <td> @{verkefni.vaegi} %</td>
                        <td></td>
                    </tr>
                    <tr class ="table_smallerFont">
                        <th> Fjöldi nemenda sem hafa skilað </th>
                        <td> @{hafaSkilad} </td>
                        <td></td>
                    </table>
            </div>
            <div class="span1">
            </div>
        </div>


        <!-- Modal -->
        <div id="deadline" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h3 id="myModalLabel">Breyta skilafrest</h3>
            </div>
            <div class="modal-body">
                @helper.form(action = routes.TeacherController.changeDeadline(verkefnihops.getVerkefnihops_id ), 'class -> "form-horizontal") {
                    <div class="control-group">
                        <label class="control-label"> Skiladagsetning </label>
                        <div class="controls">
                            <div id="datetimepicker" class="input-append date">
                                <input data-format="dd-MM-yyyy hh:mm:ss" type="text" name="lokadagsetning" class="span2">
                                <span class="add-on">
                                    <i data-time-icon="icon-time" data-date-icon="icon-calendar">
                                    </i>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button class="btn btn-primary">Staðfesta</button>
                        <button class="btn" data-dismiss="modal" aria-hidden="true">Hætta við</button>
                    </div>
                }
            </div>
        </div> <!-- Modal end -->


        @if(vidhengiNemenda == true){
        <div class="row">
            <div class="span1">
            </div>
            <div class="span9">
               <a href ="#" onclick="hideshowFade('vidNem')"> Ná í öll viðhengi nemenda sem zip skrá </a>

                <div id ="vidNem">
                @helper.form(action = routes.CommonController.downloadZip(verkefnihopsID,verkefni.heiti),'enctype -> "multipart/form-data", 'class -> "form-horizontal") {
                    <form method="get">
                        <button type="submit" class="btn btn-primary btn-small">
                            <i class="icon-download-alt"></i>
                        </button>
                            @{verkefni.heiti}.zip
                    </form>
                }
               </div>
            </div>
        </div>
        }
        @if(skilafresturLidinn==true){

        <div class= "row">
            <div class ="span1">
            </div>
            <div class = "span9">
                <a href ="#" onclick ="hideshowFade('einkunnFold')"> Gefa einkunn fyrir verkefni </a>
                @helper.form(action = routes.TeacherController.submitGrades(), 'class -> "form-horizontal") {
                    <input type ="hidden" name ="verkefni_id" value = "@{verkefni.verkefni_id}">
                    <input type ="hidden" name ="hopur_id" value = "@{hopur_id}">
                <table class = "table table-striped" id ="einkunnFold">
                    <tr>
                        <th> Nafn </th>
                        <th>  </th>
                        <th> Einkunn </th>
                    </tr>
                    <tr class="table_smallerFont">
                        @for(nem <- nemendur){
                            <input type ="hidden" name ="nemandi_id" value = "@{nem.nemandi_id}">
                            <td>@nem.getName</td>
                            <td><a href="@routes.TeacherController.getOneAssignment(nem.getVerkefninemenda_id, verkefni.getVerkefni_id, verkefni.getHeiti,nem.getName)">Skoða verkefni nemanda</a></td>
                            @if(nem.getEinkunn != 20.0){
                                <td><input name ="grade" class="input-small"  value="@{nem.getEinkunn}"/></td>
                            }else{
                                <td><input name ="grade" class="input-small"/></td>
                            }
                        </tr>
                    }
                    <td> </td>
                    <td> </td>
                    <td> <button type="submit" class="btn btn-primary" value="Staðfesta einkunnir"> Staðfesta einkunnir</button> </td>
                } <!--end of helper -->
                </table>
            </div>
        </div>
        }
        <div class="row">
            <div class ="span2">
            </div>
            <div class="span6">
                <div id="chartdiv" style="width: 110%; height: 400px;"></div>
            </div>
        </div>
    @if(verkefni.getTegund != "prof"){
        <div class = "row">
    <div class ="span1">
    </div>
    <div class="span9">
    <h3>Athugasemdir varðandi verkefnið</h3>
        @for(athugasemd <- athugasemdir){
            <div class="well">
                <p class="underScore11pt">@athugasemd.getName<span style="float: right">@athugasemd.stofnad_stengur</span></p>
                <p class="reg11pt">@athugasemd.getTexti
                    <span style="float: right">
                        <a class="btn" href="@routes.CommonController.teacherDeletesAthugasemd(athugasemd.athugasemd_id, verkefni.verkefni_id, hopur_id)" title="Eyða athugasemd"><i class="icon-trash"></i></a>
                    </span>
                </p>
            </div>
        }
        @helper.form(action=routes.CommonController.teacherAddsComment(verkefni.getVerkefni_id,hopur_id )) {
            <p>Bæta við athugasemd</p>
            <textarea class="span9" name="texti"></textarea>

            <input type="submit" class="btn btn-primary pull-right" value="Staðfesta">
                }
    </div>
    <div class ="span1">
    </div>
    </div>
      }


    </div>



}